﻿//********************************************************************************//
//创建日期：<创建日期，2016-04-11>
//创建作者：<郭登杰，guodengjie@shanghai3h.com>
//功能说明：取水相关通知书公用Model
//********************************************************************************//
using System;
using System.Collections.Generic;
using YXYLCommon;
using System.Data;

namespace Entity
{
    [Serializable]
    /// <summary>
    /// 发票库存
    /// </summary>
    public class QSQTTongZhiS : BaseModel
    {
        public QSQTTongZhiS()
        {
          
        }

        public string S_YONGHUH { get; set; }

        public string S_YONGHUM { get; set; }

        public string S_DIZHI { get; set; }

        public string S_YOUBIAN { get; set; }

        public string S_CAIWUBM { get; set; }

        public int I_YM { get; set; }

        public int I_KAICAIJH { get; set; }

        public int I_HUIGUANJH { get; set; }

        public decimal N_JINE { get; set; }

        public int I_KAICAIL { get; set; }

        public override BaseModel ToObject(System.Data.DataRow row)
        {
            this.IsExists = true;
            this.S_YONGHUH = Convert.ToString(row["S_YONGHUH"]);
            this.S_YONGHUM = Convert.ToString(row["S_YONGHUM"]);
            this.S_DIZHI = Convert.ToString(row["S_DIZHI"]);
            this.S_YOUBIAN = Convert.ToString(row["S_YOUBIAN"]);
            this.S_CAIWUBM = row.Table.Columns.Contains("S_CAIWUBM") ? Convert.ToString(row["S_CAIWUBM"]) : null;
            this.I_YM = row.Table.Columns.Contains("I_YM")?Convert.ToInt32(row["I_YM"]):-1;
            this.I_KAICAIJH = row.Table.Columns.Contains("I_KAICAIJH") ? Convert.ToInt32(row["I_KAICAIJH"]) : -1;
            this.I_HUIGUANJH = row.Table.Columns.Contains("I_HUIGUANJH") ? Convert.ToInt32(row["I_HUIGUANJH"]) : -1;
            this.I_KAICAIL = row.Table.Columns.Contains("I_KAICAIL") ? Convert.ToInt32(row["I_KAICAIL"]) : -1;
            return this;
        }
    }
    public class DALQSQTTongZhiS : BaseDAL
    {
        public DALQSQTTongZhiS()
        {

        }
        protected override void fillSaveProc(BaseModel model)
        {
            
        }

        public List<QSQTTongZhiS> Get(int type, int ym,int sl,string bm,string printdate,string returndate)
        {
            dbProc.Init("P_QSQT_TONGZHISYSJ");
            dbProc.AddParameter("V_TYPE",type);
            dbProc.AddParameter("V_YM", ym);
            dbProc.AddParameter("V_SL", sl);
            dbProc.AddParameter("V_BM", bm);
            dbProc.AddParameter("V_PRINTDATE", Convert.ToDateTime(printdate));
            dbProc.AddParameter("V_RETURNDATE", Convert.ToDateTime(returndate));
            return CommonService.Ini().GetList<QSQTTongZhiS>(dbProc);
        }

        /// <summary>
        /// 更新用户财务部门
        /// </summary>
        /// <param name="yhh">用户号</param>
        /// <param name="cwbm">财务部门</param>
        /// <param name="userid">操作人</param>
        public DbCmdResult UpdateCWBM(string yhh,string cwbm,string userid)
        {
            dbProc.Init("P_QSQT_CAIWUBMGX");
            dbProc.AddParameter("V_YONGHUH", yhh);
            dbProc.AddParameter("V_CAIWUBM", cwbm);
            dbProc.AddParameter("V_CAOZUOR", userid);
            return CommonService.Ini().ExcuteProcOracle(dbProc);
        }
    }

}